package com.example.shouybl.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.shouybl.R;
import com.example.shouybl.bean.GameHot;
import com.example.shouybl.utils.ImageLoaderUtil;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by Administrator on 2015/10/12.
 */
public class GameHotAdapter extends AppBaseAdapter<GameHot> {
    private final DisplayImageOptions options;
    public GameHotAdapter(List<GameHot> list, Context context) {
        super(list, context);
        options = ImageLoaderUtil.getDefaultOptions();
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        GameHot hot=list.get(position);
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_game_gview_layout);
        ImageView ivIcon= (ImageView) vh.findViewById(R.id.game_hot_img);
        TextView tvName= (TextView) vh.findViewById(R.id.game_hot_name);

        ImageLoader.getInstance().displayImage(hot.getIcon(),ivIcon,options);
        tvName.setText(hot.getName());

        return vh;
    }
}
